package perl.compiler.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class CodeLoader {
	
	public static List<StringBuilder> readFile(String fileName) throws IOException {
	    BufferedReader br = new BufferedReader(new FileReader(fileName));
	    try {
	    	
	    	List<StringBuilder> codeLines = new ArrayList<StringBuilder>();
	        StringBuilder sb = new StringBuilder();
	        String line = br.readLine();

	        while (line != null) {
	           // sb.append(line);	            
	           // sb.append(System.getProperty("line.separator"));
	        	codeLines.add(new StringBuilder(line));
	            line = br.readLine();
	            
	        }
	        return codeLines;
	    } finally {
	        br.close();
	    }
	}

}
